3.1.42 \(\int x (a+b x^2) \sin (c+d x) \, dx\) [42]

Optimal. Leaf size=80 \[ \frac {6 b x \cos (c+d x)}{d^3}-\frac {a x \cos (c+d x)}{d}-\frac {b x^3 \cos (c+d x)}{d}-\frac {6 b \sin (c+d x)}{d^4}+\frac {a \sin (c+d x)}{d^2}+\frac {3 b x^2 \sin (c+d x)}{d^2} \]

[Out]

6*b*x*cos(d*x+c)/d^3-a*x*cos(d*x+c)/d-b*x^3*cos(d*x+c)/d-6*b*sin(d*x+c)/d^4+a*sin(d*x+c)/d^2+3*b*x^2*sin(d*x+c
)/d^2

________________________________________________________________________________________

Rubi [A]
time = 0.07, antiderivative size = 80, normalized size of antiderivative = 1.00, number of steps used = 8, number of rules used = 3, integrand size = 15, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.200, Rules used = {3420, 3377, 2717} \begin {gather*} \frac {a \sin (c+d x)}{d^2}-\frac {a x \cos (c+d x)}{d}-\frac {6 b \sin (c+d x)}{d^4}+\frac {6 b x \cos (c+d x)}{d^3}+\frac {3 b x^2 \sin (c+d x)}{d^2}-\frac {b x^3 \cos (c+d x)}{d} \end {gather*}

Antiderivative was successfully verified.

[In]

Int[x*(a + b*x^2)*Sin[c + d*x],x]

[Out]

(6*b*x*Cos[c + d*x])/d^3 - (a*x*Cos[c + d*x])/d - (b*x^3*Cos[c + d*x])/d - (6*b*Sin[c + d*x])/d^4 + (a*Sin[c +
 d*x])/d^2 + (3*b*x^2*Sin[c + d*x])/d^2

Rule 2717

Int[sin[Pi/2 + (c_.) + (d_.)*(x_)], x_Symbol] :> Simp[Sin[c + d*x]/d, x] /; FreeQ[{c, d}, x]

Rule 3377

Int[((c_.) + (d_.)*(x_))^(m_.)*sin[(e_.) + (f_.)*(x_)], x_Symbol] :> Simp[(-(c + d*x)^m)*(Cos[e + f*x]/f), x]
+ Dist[d*(m/f), Int[(c + d*x)^(m - 1)*Cos[e + f*x], x], x] /; FreeQ[{c, d, e, f}, x] && GtQ[m, 0]

Rule 3420

Int[((e_.)*(x_))^(m_.)*((a_) + (b_.)*(x_)^(n_))^(p_.)*Sin[(c_.) + (d_.)*(x_)], x_Symbol] :> Int[ExpandIntegran
d[Sin[c + d*x], (e*x)^m*(a + b*x^n)^p, x], x] /; FreeQ[{a, b, c, d, e, m, n}, x] && IGtQ[p, 0]

Rubi steps

\begin {align*} \int x \left (a+b x^2\right ) \sin (c+d x) \, dx &=\int \left (a x \sin (c+d x)+b x^3 \sin (c+d x)\right ) \, dx\\ &=a \int x \sin (c+d x) \, dx+b \int x^3 \sin (c+d x) \, dx\\ &=-\frac {a x \cos (c+d x)}{d}-\frac {b x^3 \cos (c+d x)}{d}+\frac {a \int \cos (c+d x) \, dx}{d}+\frac {(3 b) \int x^2 \cos (c+d x) \, dx}{d}\\ &=-\frac {a x \cos (c+d x)}{d}-\frac {b x^3 \cos (c+d x)}{d}+\frac {a \sin (c+d x)}{d^2}+\frac {3 b x^2 \sin (c+d x)}{d^2}-\frac {(6 b) \int x \sin (c+d x) \, dx}{d^2}\\ &=\frac {6 b x \cos (c+d x)}{d^3}-\frac {a x \cos (c+d x)}{d}-\frac {b x^3 \cos (c+d x)}{d}+\frac {a \sin (c+d x)}{d^2}+\frac {3 b x^2 \sin (c+d x)}{d^2}-\frac {(6 b) \int \cos (c+d x) \, dx}{d^3}\\ &=\frac {6 b x \cos (c+d x)}{d^3}-\frac {a x \cos (c+d x)}{d}-\frac {b x^3 \cos (c+d x)}{d}-\frac {6 b \sin (c+d x)}{d^4}+\frac {a \sin (c+d x)}{d^2}+\frac {3 b x^2 \sin (c+d x)}{d^2}\\ \end {align*}

________________________________________________________________________________________

Mathematica [A]
time = 0.09, size = 57, normalized size = 0.71 \begin {gather*} \frac {-d x \left (a d^2+b \left (-6+d^2 x^2\right )\right ) \cos (c+d x)+\left (a d^2+3 b \left (-2+d^2 x^2\right )\right ) \sin (c+d x)}{d^4} \end {gather*}

Antiderivative was successfully verified.

[In]

Integrate[x*(a + b*x^2)*Sin[c + d*x],x]

[Out]

(-(d*x*(a*d^2 + b*(-6 + d^2*x^2))*Cos[c + d*x]) + (a*d^2 + 3*b*(-2 + d^2*x^2))*Sin[c + d*x])/d^4

________________________________________________________________________________________

Maple [B] Leaf count of result is larger than twice the leaf count of optimal. \(180\) vs. \(2(80)=160\).
time = 0.04, size = 181, normalized size = 2.26

method result size
risch \(-\frac {x \left (d^{2} x^{2} b +d^{2} a -6 b \right ) \cos \left (d x +c \right )}{d^{3}}+\frac {\left (3 d^{2} x^{2} b +d^{2} a -6 b \right ) \sin \left (d x +c \right )}{d^{4}}\) \(59\)
norman \(\frac {\frac {b \,x^{3} \left (\tan ^{2}\left (\frac {d x}{2}+\frac {c}{2}\right )\right )}{d}+\frac {\left (d^{2} a -6 b \right ) x \left (\tan ^{2}\left (\frac {d x}{2}+\frac {c}{2}\right )\right )}{d^{3}}-\frac {b \,x^{3}}{d}-\frac {\left (d^{2} a -6 b \right ) x}{d^{3}}+\frac {2 \left (d^{2} a -6 b \right ) \tan \left (\frac {d x}{2}+\frac {c}{2}\right )}{d^{4}}+\frac {6 b \,x^{2} \tan \left (\frac {d x}{2}+\frac {c}{2}\right )}{d^{2}}}{1+\tan ^{2}\left (\frac {d x}{2}+\frac {c}{2}\right )}\) \(127\)
meijerg \(\frac {8 b \sqrt {\pi }\, \sin \left (c \right ) \left (\frac {3}{4 \sqrt {\pi }}-\frac {\left (-\frac {3 d^{2} x^{2}}{2}+3\right ) \cos \left (d x \right )}{4 \sqrt {\pi }}-\frac {d x \left (-\frac {d^{2} x^{2}}{2}+3\right ) \sin \left (d x \right )}{4 \sqrt {\pi }}\right )}{d^{4}}+\frac {8 b \sqrt {\pi }\, \cos \left (c \right ) \left (\frac {x d \left (-\frac {5 d^{2} x^{2}}{2}+15\right ) \cos \left (d x \right )}{20 \sqrt {\pi }}-\frac {\left (-\frac {15 d^{2} x^{2}}{2}+15\right ) \sin \left (d x \right )}{20 \sqrt {\pi }}\right )}{d^{4}}+\frac {2 a \sqrt {\pi }\, \sin \left (c \right ) \left (-\frac {1}{2 \sqrt {\pi }}+\frac {\cos \left (d x \right )}{2 \sqrt {\pi }}+\frac {d x \sin \left (d x \right )}{2 \sqrt {\pi }}\right )}{d^{2}}+\frac {2 a \sqrt {\pi }\, \cos \left (c \right ) \left (-\frac {d x \cos \left (d x \right )}{2 \sqrt {\pi }}+\frac {\sin \left (d x \right )}{2 \sqrt {\pi }}\right )}{d^{2}}\) \(180\)
derivativedivides \(\frac {a c \cos \left (d x +c \right )+a \left (\sin \left (d x +c \right )-\left (d x +c \right ) \cos \left (d x +c \right )\right )+\frac {b \,c^{3} \cos \left (d x +c \right )}{d^{2}}+\frac {3 b \,c^{2} \left (\sin \left (d x +c \right )-\left (d x +c \right ) \cos \left (d x +c \right )\right )}{d^{2}}-\frac {3 b c \left (-\left (d x +c \right )^{2} \cos \left (d x +c \right )+2 \cos \left (d x +c \right )+2 \left (d x +c \right ) \sin \left (d x +c \right )\right )}{d^{2}}+\frac {b \left (-\left (d x +c \right )^{3} \cos \left (d x +c \right )+3 \left (d x +c \right )^{2} \sin \left (d x +c \right )-6 \sin \left (d x +c \right )+6 \left (d x +c \right ) \cos \left (d x +c \right )\right )}{d^{2}}}{d^{2}}\) \(181\)
default \(\frac {a c \cos \left (d x +c \right )+a \left (\sin \left (d x +c \right )-\left (d x +c \right ) \cos \left (d x +c \right )\right )+\frac {b \,c^{3} \cos \left (d x +c \right )}{d^{2}}+\frac {3 b \,c^{2} \left (\sin \left (d x +c \right )-\left (d x +c \right ) \cos \left (d x +c \right )\right )}{d^{2}}-\frac {3 b c \left (-\left (d x +c \right )^{2} \cos \left (d x +c \right )+2 \cos \left (d x +c \right )+2 \left (d x +c \right ) \sin \left (d x +c \right )\right )}{d^{2}}+\frac {b \left (-\left (d x +c \right )^{3} \cos \left (d x +c \right )+3 \left (d x +c \right )^{2} \sin \left (d x +c \right )-6 \sin \left (d x +c \right )+6 \left (d x +c \right ) \cos \left (d x +c \right )\right )}{d^{2}}}{d^{2}}\) \(181\)

Verification of antiderivative is not currently implemented for this CAS.

[In]

int(x*(b*x^2+a)*sin(d*x+c),x,method=_RETURNVERBOSE)

[Out]

1/d^2*(a*c*cos(d*x+c)+a*(sin(d*x+c)-(d*x+c)*cos(d*x+c))+1/d^2*b*c^3*cos(d*x+c)+3/d^2*b*c^2*(sin(d*x+c)-(d*x+c)
*cos(d*x+c))-3/d^2*b*c*(-(d*x+c)^2*cos(d*x+c)+2*cos(d*x+c)+2*(d*x+c)*sin(d*x+c))+1/d^2*b*(-(d*x+c)^3*cos(d*x+c
)+3*(d*x+c)^2*sin(d*x+c)-6*sin(d*x+c)+6*(d*x+c)*cos(d*x+c)))

________________________________________________________________________________________

Maxima [B] Leaf count of result is larger than twice the leaf count of optimal. 165 vs. \(2 (80) = 160\).
time = 0.28, size = 165, normalized size = 2.06 \begin {gather*} \frac {a c \cos \left (d x + c\right ) + \frac {b c^{3} \cos \left (d x + c\right )}{d^{2}} - {\left ({\left (d x + c\right )} \cos \left (d x + c\right ) - \sin \left (d x + c\right )\right )} a - \frac {3 \, {\left ({\left (d x + c\right )} \cos \left (d x + c\right ) - \sin \left (d x + c\right )\right )} b c^{2}}{d^{2}} + \frac {3 \, {\left ({\left ({\left (d x + c\right )}^{2} - 2\right )} \cos \left (d x + c\right ) - 2 \, {\left (d x + c\right )} \sin \left (d x + c\right )\right )} b c}{d^{2}} - \frac {{\left ({\left ({\left (d x + c\right )}^{3} - 6 \, d x - 6 \, c\right )} \cos \left (d x + c\right ) - 3 \, {\left ({\left (d x + c\right )}^{2} - 2\right )} \sin \left (d x + c\right )\right )} b}{d^{2}}}{d^{2}} \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate(x*(b*x^2+a)*sin(d*x+c),x, algorithm="maxima")

[Out]

(a*c*cos(d*x + c) + b*c^3*cos(d*x + c)/d^2 - ((d*x + c)*cos(d*x + c) - sin(d*x + c))*a - 3*((d*x + c)*cos(d*x
+ c) - sin(d*x + c))*b*c^2/d^2 + 3*(((d*x + c)^2 - 2)*cos(d*x + c) - 2*(d*x + c)*sin(d*x + c))*b*c/d^2 - (((d*
x + c)^3 - 6*d*x - 6*c)*cos(d*x + c) - 3*((d*x + c)^2 - 2)*sin(d*x + c))*b/d^2)/d^2

________________________________________________________________________________________

Fricas [A]
time = 0.36, size = 60, normalized size = 0.75 \begin {gather*} -\frac {{\left (b d^{3} x^{3} + {\left (a d^{3} - 6 \, b d\right )} x\right )} \cos \left (d x + c\right ) - {\left (3 \, b d^{2} x^{2} + a d^{2} - 6 \, b\right )} \sin \left (d x + c\right )}{d^{4}} \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate(x*(b*x^2+a)*sin(d*x+c),x, algorithm="fricas")

[Out]

-((b*d^3*x^3 + (a*d^3 - 6*b*d)*x)*cos(d*x + c) - (3*b*d^2*x^2 + a*d^2 - 6*b)*sin(d*x + c))/d^4

________________________________________________________________________________________

Sympy [A]
time = 0.21, size = 99, normalized size = 1.24 \begin {gather*} \begin {cases} - \frac {a x \cos {\left (c + d x \right )}}{d} + \frac {a \sin {\left (c + d x \right )}}{d^{2}} - \frac {b x^{3} \cos {\left (c + d x \right )}}{d} + \frac {3 b x^{2} \sin {\left (c + d x \right )}}{d^{2}} + \frac {6 b x \cos {\left (c + d x \right )}}{d^{3}} - \frac {6 b \sin {\left (c + d x \right )}}{d^{4}} & \text {for}\: d \neq 0 \\\left (\frac {a x^{2}}{2} + \frac {b x^{4}}{4}\right ) \sin {\left (c \right )} & \text {otherwise} \end {cases} \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate(x*(b*x**2+a)*sin(d*x+c),x)

[Out]

Piecewise((-a*x*cos(c + d*x)/d + a*sin(c + d*x)/d**2 - b*x**3*cos(c + d*x)/d + 3*b*x**2*sin(c + d*x)/d**2 + 6*
b*x*cos(c + d*x)/d**3 - 6*b*sin(c + d*x)/d**4, Ne(d, 0)), ((a*x**2/2 + b*x**4/4)*sin(c), True))

________________________________________________________________________________________

Giac [A]
time = 3.40, size = 60, normalized size = 0.75 \begin {gather*} -\frac {{\left (b d^{3} x^{3} + a d^{3} x - 6 \, b d x\right )} \cos \left (d x + c\right )}{d^{4}} + \frac {{\left (3 \, b d^{2} x^{2} + a d^{2} - 6 \, b\right )} \sin \left (d x + c\right )}{d^{4}} \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate(x*(b*x^2+a)*sin(d*x+c),x, algorithm="giac")

[Out]

-(b*d^3*x^3 + a*d^3*x - 6*b*d*x)*cos(d*x + c)/d^4 + (3*b*d^2*x^2 + a*d^2 - 6*b)*sin(d*x + c)/d^4

________________________________________________________________________________________

Mupad [B]
time = 0.14, size = 73, normalized size = 0.91 \begin {gather*} \frac {x\,\cos \left (c+d\,x\right )\,\left (6\,b-a\,d^2\right )}{d^3}-\frac {\sin \left (c+d\,x\right )\,\left (6\,b-a\,d^2\right )}{d^4}-\frac {b\,x^3\,\cos \left (c+d\,x\right )}{d}+\frac {3\,b\,x^2\,\sin \left (c+d\,x\right )}{d^2} \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

int(x*sin(c + d*x)*(a + b*x^2),x)

[Out]

(x*cos(c + d*x)*(6*b - a*d^2))/d^3 - (sin(c + d*x)*(6*b - a*d^2))/d^4 - (b*x^3*cos(c + d*x))/d + (3*b*x^2*sin(
c + d*x))/d^2

________________________________________________________________________________________